/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.task.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.task.model.*;
import com.tech15.task.dao.*;
import com.tech15.task.service.*;
import com.tech15.task.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "PROCESS_INSTANCE")
public class ProcessInstance extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "流程实例";
	public static final String ALIAS_PIID = "实例序号";
	public static final String ALIAS_TASKID = "任务id";
	public static final String ALIAS_NODENAME = "节点名称";
	public static final String ALIAS_STEPNO = "步骤编号";
	public static final String ALIAS_EXECUTOR = "执行人";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 实例序号       db_column: PIID 
     */ 	
	
	private Long piid;
    /**
     * 任务id       db_column: TASKID 
     */ 	
	
	private Long taskid;
	/**
     * 流程id       db_column: WFID 
     */ 	
	
	private Long wfid;
    /**
     * 节点名称       db_column: NODENAME 
     */ 	
	@Length(max=60)
	private java.lang.String nodename;
    /**
     * 步骤编号       db_column: STEPNO 
     */ 	
	@Max(32767)
	private Integer stepno;
    /**
     * 执行人       db_column: EXECUTOR 
     */ 	
	
	private Long executor;
	//columns END


	public ProcessInstance(){
	}

	public ProcessInstance(
		Long piid
	){
		this.piid = piid;
	}

	

	public void setPiid(Long value) {
		this.piid = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "PIID", unique = true, nullable = false, insertable = true, updatable = true, length = 22)
	public Long getPiid() {
		return this.piid;
	}
	
	@Column(name = "TASKID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getTaskid() {
		return this.taskid;
	}
	
	public void setTaskid(Long value) {
		this.taskid = value;
	}
	
	@Column(name = "WFID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getWfid() {
		return this.wfid;
	}
	
	public void setWfid(Long value) {
		this.wfid = value;
	}
	
	@Column(name = "NODENAME", unique = false, nullable = true, insertable = true, updatable = true, length = 60)
	public java.lang.String getNodename() {
		return this.nodename;
	}
	
	public void setNodename(java.lang.String value) {
		this.nodename = value;
	}
	
	@Column(name = "STEPNO", unique = false, nullable = true, insertable = true, updatable = true, length = 3)
	public Integer getStepno() {
		return this.stepno;
	}
	
	public void setStepno(Integer value) {
		this.stepno = value;
	}
	
	@Column(name = "EXECUTOR", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getExecutor() {
		return this.executor;
	}
	
	public void setExecutor(Long value) {
		this.executor = value;
	}
	
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Piid",getPiid())
			.append("Taskid",getTaskid())
			.append("Nodename",getNodename())
			.append("Stepno",getStepno())
			.append("Executor",getExecutor())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getPiid())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof ProcessInstance == false) return false;
		if(this == obj) return true;
		ProcessInstance other = (ProcessInstance)obj;
		return new EqualsBuilder()
			.append(getPiid(),other.getPiid())
			.isEquals();
	}
}

